<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        table {border-collapse: collapse;margin: 10px auto;}
        th,td {border:1px solid #666;}
    </style>
</head>
<body>
<form action="" method="post">
    <select name="startYear">
        <%for(var i=2015;i<=2017;i++){%>
            <%if(i==start.getFullYear()){%>
                <option value="<%=i%>" selected><%=i%></option>
            <%}else{%>
                <option value="<%=i%>"><%=i%></option>
            <%}%>
        <%}%>
    </select>
    <select name="startMonth" id="">
        <%for(var i=1;i<=12;i++){%>
            <%if(i==start.getMonth()+1){%>
                    <option value="<%=i%>" selected><%=i%></option>
                <%}else{%>
                    <option value="<%=i%>"><%=i%></option>
            <%}%>
        <%}%>
    </select>
    <select name="startDay" id="">
        <%for(var i=1;i<=31;i++){%>
            <%if(i==start.getDate()){%>
                <option value="<%=i%>" selected><%=i%></option>
            <%}else{%>
                <option value="<%=i%>"><%=i%></option>
            <%}%>
        <%}%>
    </select>

    --

    <select name="endYear">
        <%for(var i=2015;i<=2017;i++){%>
            <%if(i==end.getFullYear()){%>
                <option value="<%=i%>" selected><%=i%></option>
            <%}else{%>
                <option value="<%=i%>"><%=i%></option>
            <%}%>
        <%}%>
    </select>
    <select name="endMonth" id="">
        <%for(var i=1;i<=12;i++){%>
            <%if(i==end.getMonth()+1){%>
                <option value="<%=i%>" selected><%=i%></option>
            <%}else{%>
                <option value="<%=i%>"><%=i%></option>
            <%}%>
        <%}%>
    </select>
    <select name="endDay" id="">
        <%for(var i=1;i<=31;i++){%>
            <%if(i==end.getDate()){%>
                <option value="<%=i%>" selected><%=i%></option>
            <%}else{%>
                <option value="<%=i%>"><%=i%></option>
            <%}%>
        <%}%>
    </select>
    <input type="submit" value="Search">
</form>
<%if(group){%>
    <%for(var date in group){%>
    <table width="100%" border="0">
        <tr>
            <th colspan="2"><%= date %></th>
        </tr>
        <tr>
            <th>Name</th>
            <th>Time</th>
        </tr>
        <%for(var i=0;i<group[date].length;i++){%>
        <tr>
            <td><%= group[date][i].name %></td>
            <td><%= group[date][i].time.toLocaleString() %></td>
        </tr>
        <%}%>
    </table>
    <%}%>
<%}%>

</body>
</html>